package com.cyl.game.demos.web.service.Impl;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cyl.game.demos.web.entity.Skin;
import com.cyl.game.demos.web.mapper.SkinMapper;
import com.cyl.game.demos.web.service.SkinService;

import lombok.RequiredArgsConstructor;

@Service
@Transactional
@RequiredArgsConstructor
public class SkinServiceImpl implements SkinService {

    private final SkinMapper skinMapper;

    @Override
    public void addSkin(Skin skin) {
        skinMapper.insertSkin(skin);
    }

    @Override
    public Skin getSkinById(Integer skin_id) {
        return skinMapper.selectSkinById(skin_id);
    }

    @Override
    public List<Skin> getSkinsByHeroId(Integer hero_id) {
        return skinMapper.selectSkinsByHeroId(hero_id);
    }

    @Override
    public List<Skin> getSkinsByRarity(String skin_rarity) {
        return skinMapper.selectSkinsByRarity(skin_rarity);
    }

    @Override
    public List<Skin> getAvailableSkins() {
        return skinMapper.selectAvailableSkins();
    }

    @Override
    public void updateSkin(Skin skin) {
        skinMapper.updateSkin(skin);
    }

    @Override
    public void deleteSkinById(Integer skin_id) {
        skinMapper.deleteSkinById(skin_id);
    }
}